//
//  YSProductDetailBusinessIntroduceView.m
//  Yueshi
//
//  Created by Northwan on 15/7/22.
//  Copyright (c) 2015年 悦食中国. All rights reserved.
//

#import "YSProductDetailBusinessIntroduceView.h"
@interface YSProductDetailBusinessIntroduceView()
@property (weak, nonatomic) IBOutlet UIImageView *logoView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *subTitleLabel;
@property (weak, nonatomic) IBOutlet UIView *starsContainerView;

@end

@implementation YSProductDetailBusinessIntroduceView

+ (instancetype)businiessView{
    return [[[NSBundle mainBundle]loadNibNamed:@"YSProductDetailBusinessIntroduceView" owner:nil options:nil]lastObject];
}

-(void)setSupplier:(YSSupplier *)supplier{
    [self.logoView setImageURLStr:supplier.logo];
    [self.titleLabel setText:supplier.supplierName];
    [self.subTitleLabel setText:[NSString stringWithFormat:@"商品数量:%ld",supplier.prodNum]];
    for (int i = 0; i<=5; i++) {
        if(i<supplier.level){
            UIImageView *star =  self.starsContainerView.subviews[i];
            if(i+0.5 == supplier.level){
                [star setImage:[UIImage imageNamed:@"btn_star_pre_half"]];
            }else{
                [star setImage:[UIImage imageNamed:@"btn_star_pre_whole"]];
            }
        }
    }
}

@end
